const { defineConfig } = require('@vue/cli-service')
const path = require('path')
const fs = require('fs')
module.exports = defineConfig({
  transpileDependencies: true,
  chainWebpack: config => {
    config.plugin('html').tap(args => {
      args[0].template = './public/index.html'
      return args
    })
  },
  devServer: {
    https: {
      cert: fs.readFileSync(path.join(__dirname, 'src/ssl/server.crt')),
      key: fs.readFileSync(path.join(__dirname, 'src/ssl/server.key')),
    },
    proxy: {
      // detail: https://cli.vuejs.org/config/#devserver-proxy
      "/dev-api": {
        target: `http://127.0.0.1:8080`,
        changeOrigin: true,
        pathRewrite: {
          "^/dev-api": "",
        },
      },
    },
  }
})
